﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;


namespace NextViewer
{
    class Pot
    {
        
        
        public DateTime Time;

        public int WIFI;
        public int Brightness;
        public int BT;
        public int Sound;
        public int GPS;
        public double Lat;
        public double Lon;
        public string App;
        public int headset;
        public int plugged;
        public float Accuracy;
        public float Speed;
        public int CellID;


        //cholonge wrote
        public double appLat;
        public double appLon;     
        public double velocity;   // 속력
        //public double tm_x;       // 미완성
        //public double tm_y;       // 미완성
        public double tm_slope;   // 향하는 방향
        public double accel;      // 가속력(가속도 아님)
        public double acc_angle;  // 0도~180도의 방향전환각도
        public double dist_prev; // 앞 데이터와의 거리
        public TimeSpan tm_span; // 맨 첫 데이터는 0 두번째 것부터 앞에꺼랑 비교  
        public bool moveable; // true = 옮길 필요성이 있다. false = 옮길 필요성이 없다.
        public bool thro; // true = 던져야 합니다.

        //gps LatLon
        public double gpsLat;
        public double gpsLon;

        // penalty values
        public double pen_a;
        public double pen_b;
        public double pen_c;
        public double coef_a;
        public double coef_b;
        public double coef_c;

        public Pot()
        {
            appLat = 0.0;
            appLon = 0.0;
            moveable = true;
            thro = false;
        }
    }
    class Points
    {
        public Points()
        {
            mPt = new List<Pot>();
        }
        public string ID;

        public List<Pot> GetList(DateTime dt)
        {
            List<Pot> temp = new List<Pot>();
            foreach (Pot pt in mPt) 
            {
                if (pt.Time == dt)
                    temp.Add(pt);

            }
            return temp;
        }
        private List<Pot> GetDateList(DateTime dt)
        {
            List<Pot> temp = new List<Pot>();
            foreach (Pot pt in mPt)
            {
                if (pt.Time.Date == dt.Date)
                    temp.Add(pt);

            }
            return temp;
        }
        private List<Pot> GetHourList(DateTime dt)
        {
            List<Pot> temp = new List<Pot>();
            foreach (Pot pt in mPt)
            {
                if(pt.Time.Hour == dt.Hour)
                    temp.Add(pt);

            }
            return temp;
        }
        private List<Pot> GetDateHourList(DateTime dt)
        {
            List<Pot> temp = new List<Pot>();
            foreach (Pot pt in mPt)
            {
                if (pt.Time.Date == dt.Date && pt.Time.Hour == dt.Hour)
                    temp.Add(pt);

            }
            return temp;
        }
        private List<Pot> GetDOWList(DateTime dt)
        {
            List<Pot> temp = new List<Pot>();
            foreach (Pot pt in mPt)
            {
                if (pt.Time.DayOfWeek == dt.DayOfWeek)
                    temp.Add(pt);

            }
            return temp;
        }
        public List<Pot> GetList(DateTime dt, int option)
        {
            switch (option)
            {
                case DATE_ALL:
                    return GetList(dt);
                case DATE_ONLY:
                    return GetDateList(dt);
                case DATEHOUR_ONLY:
                    return GetDateHourList(dt);
                case HOUR_ONLY:
                    return GetHourList(dt);
                case DAY_OF_WEEK:
                    return GetDOWList(dt);
                default:
                    return null;
            }

        }
        

        public List<Pot> mPt;
        public  const int DATE_ALL = 0;
        public  const int DATE_ONLY=1;
        public  const int DATEHOUR_ONLY = 2;
        public  const int HOUR_ONLY=3;
        public  const int DAY_OF_WEEK = 4;

    }

}
